home *** CD-ROM | disk | FTP | other *** search
- Subject: Re: Tech Q: Additional Storage Units
- Sent: 5/29/96 9:00 AM
- Received: 5/29/96 9:08 AM
- From: Henri Lamiraux, lamiraux@apple.com
- Reply-To: ODF Interest, ODF-Interest@CILabs.ORG
- To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
-
- >On page 301 of the _IM:OpenDoc Programmer's Guide_, there is a recipe for
- >creating additional storage units.
- >
- >Here's what I'm unclear about. Should I call GetStrongStorageUnitRef every
- >time I externalize my part, or should I save the strong reference and write
- >the same thing to my main storage unit's value each time?
- >
- >Also, how/when do I dispose of the Strong Reference (i.e., if I no longer
- >need it).
- >
- >The question is prompted by ODF's internalization/externalization model,
- >which is geared toward doing it all at once, as opposed to on an as needed
- >basis (as I understand it). But I guess I see no reason why an ODF Content
- >object couldn't have access to the storage unit when needed.
- >
- >Brad
- >
- >
- >Richard B. "Brad" Hutchings
- >General Partner,
- >Hutchings Software Development
- >
- >hsd@earthlink.net
-
- To use a secondary storage unit you need first to create it (for example
- the first time you externalize your part or at init time). At externalize
- time store the strong reference to your secondary storage unit in your
- part kind value instead of writing there your data. In your secondary
- storage unit create whatever property/value you need and write your data.
- If you support multiple kind you need to write out the other kinds the
- normal way in the part storage unit. Which raises an interesting point,
- if you are using a standard kind for your part kind (like plain text) it
- means that you cannot use a secondary storage. Otherwise another editor
- won't be able to read it. You can only use a secondary storage for your
- own private kind.
-
- At internalize time, focus on your part kind, read the strong reference,
- acquire the storage unit using the strong reference and then focus on
- what ever property/value is needed in the secondary storage unit.
-
- You don't have to read/write everything at once with ODF. You can for
- example write to your storage unit anytime you want. OpenDoc will still
- call Externalize went your part is saved. What you may want to do (and I
- have already added that to ODF release 2) is add a fDirty flag to your
- part. Set it to true when changing your data. When writting your data
- outside of an externalize set this flag to false. When OpenDoc calls
- Externalize test this flag and don't do anything if the flag is false.
-
- .......................................................................
- Henri Lamiraux lamiraux@apple.com
- Apple Computer, Inc. OpenDoc(tm) Development Framework
- .......................................................................
-
-